import { type pageInfo } from '@/page/types/base/baseRequestPage'

export interface roleInfo extends pageInfo {
  id: string | null
  roleName: string
  code: string
  roleSort: number | null
  work: boolean | null
  edit: boolean | null
  status: boolean
  createTime: string
  remark: string
}

export class roleClass {
  dialogFormVisible = false
  dialogMenu = false
  roleTable = [] as roleInfo[]
  count = 0
  page = 0
  size = 0
  total = 0
  roleData: roleInfo = {
    id: null,
    roleName: '',
    code: '',
    roleSort: null,
    work: null,
    edit: null,
    status: false,
    createTime: '',
    remark: '',
    page: 1,
    size: 10,
    total: 0
  }

  rolePage: roleInfo = {
    id: null,
    roleName: '',
    code: '',
    roleSort: null,
    work: null,
    edit: null,
    status: false,
    createTime: '',
    remark: '',
    page: 1,
    size: 10,
    total: 0
  }

  roleEdit: roleInfo = {
    id: null,
    roleName: '',
    code: '',
    roleSort: null,
    work: null,
    edit: null,
    status: false,
    createTime: '',
    remark: '',
    page: 1,
    size: 10,
    total: 0
  }

  roleAdd: roleInfo = {
    id: null,
    roleName: '',
    code: '',
    roleSort: null,
    work: null,
    edit: null,
    status: false,
    createTime: '',
    remark: '',
    page: 1,
    size: 10,
    total: 0
  }

  treeProps = {
    label: 'name',
    children: 'zones'
  }

  addRoleRuls = {
    roleName: [{ requested: true, message: '角色名称不能为空' }],
    code: [{ requested: true, message: '角色编码不能为空' }]
  }

  types = [
    {
      value: '1',
      label: '正常'
    },
    {
      value: '0',
      label: '停用'
    }
  ]

  roleId = 0 as number | null
  treeChecked = false
  props = {
    label: 'name',
    children: 'children'
  }
}
